This invention relates to synchronizing databases.
Databases are collections of data entries which are organized, stored, and manipulated in a manner specified by applications known as database managers (hereinafter also referred to as xe2x80x9cApplicationsxe2x80x9d; hereinafter, the term xe2x80x9cdatabasexe2x80x9d also refers to a database manager combined with a database proper). The manner in which database entries are organized in a database is known as the data structure of the database. There are generally two types of database managers. First are general purpose database managers in which the user determines (usually at the outset, but subject to future revisions) what the data structure is. These Applications often have their own programming language and provide great flexibility to the user. Second are special purpose database managers that are specifically designed to create and manage a database having a preset data structure. Examples of these special purpose database managers are various scheduling, diary, and contact manager applications for desktop and handheld computers. Database managers organize the information in a database into records, with each record made up of fields. Fields and records of a database may have many different characteristics depending on the database manager""s purpose and utility.
Databases can be said to be incompatible with one another when the data structure of one is not the same as the data structure of another, even though some of the content of the records is substantially the same.
Often users of incompatible databases want to be able to synchronize them with one another. For example, in the context of scheduling and contact manager Applications, a person might use one application on a desktop computer at work while another on his handheld computer or his laptop computer while away from work. It is desirable for many of these users to be able to synchronize the entries on one with entries on another. U.S. patents of the assignee hereof, Puma Technology, Inc. of San Jose, Calif. (U.S. Pat. No. 5,392,390, hereinafter, xe2x80x9cthe ""390 patentxe2x80x9d, incorporated by reference herein; and U.S. Pat. No. 5,684,990, filed on Jan. 11, 1995, incorporated by reference herein) show two methods for synchronizing incompatible databases and solving some of the problems arising from incompatibility of databases.
In one aspect, the invention features a computer program and a computer implemented method for synchronizing two databases by attempting to identify a plurality of records of the second database storing a span of information stored in a record of the first database and synchronizing the first database and the second database based on the results of the attempt.
Preferred embodiments of the invention may include one or more of the following features.
To synchronize the first database and the second database, the plurality of records of the second database are processed to generate a record representative of a span of information represented by the plurality of records of the second database. The generated record is then compared to the record of the first database and synchronization action is taken based on the comparison.
The span of information represented by the record of the first database may include date-bearing information such as recurring date-bearing information or a continuous span of information. If the span of information includes recurring date-bearing information, the identified plurality of records of the second database may represent instances of a recurring date-bearing record.
The span of information may be a continuous period of time. In that case, the starting time and date and the ending time and date of the record of the first database span a period of time longer than a period permitted by the second database. Each of the identified plurality of the records of the second database stores a portion of the span of the information, where the identified plurality of records of the second database in combination store the span of information or a selected segment thereof. The continuous period of time can be longer than a period of time permitted by the second database. The identified plurality of records of the second database may include a recurring record. Note that the record of the first database may also be a recurring record where each instance stores a span of information greater than that permitted by the second database.
Synchronizing the first database and the second database includes adding, modifying, or deleting one of the records.
The record of the first database is deleted, if the attempt to identify the plurality of records of the second database is unsuccessful.
If a plurality of records of the second database is identified as storing the span of information stored in the record of the first database, synchronizing the first database and the second database includes comparing the record of the first database to the identified plurality of records of the second database and synchronizing the identified plurality of records of the second database with the record of the first database based on the results of the comparison.
The identified plurality of records of the second database are processed to generate a span of information representative of information stored in the identified plurality of records of the second database. Then, comparing the record of the first database to the records of the second database includes comparing the span of information stored in the record of the first database to the generated span of information. In addition, a record is generated based on the identified plurality of records of the second database where the record stores the generated span of information. This generated record is then used for comparing the record of the first database to the identified plurality of the second database.
A history file stores information reflecting the records of the first and second databases at a previous synchronization. The record of the first database and the identified plurality of records of the second database are compared to the information in the history file. Synchronizing the first database and the second database then includes synchronizing based on results of the comparison to the history file.
The records of the second database can be compared to the information in the history file to identify the plurality of records of the second database based on the results of the comparison. Alternatively, the record of the first database can be compared to the records of the second database to identify the plurality of records of the second database.
Additionally, the record of the first database can be a record which was present during the previous synchronization and which was deleted from the first database prior to the current synchronization. Synchronizing the first database and the second database then includes deleting the identified plurality of records of the second database.
To identify the plurality of records of the second database, a plurality of instances are generated based on a previously determined pattern for generating a plurality of instances which in combination represent the span of information stored by the record of the first database. A second plurality of the records of the second database are then correlated to the plurality of generated instances by comparing the plurality of generated instances to the records of the second database. The second plurality of the records of the second database is then determined to be the identified plurality of records of the second database.
The previously determined pattern is selected based on a characteristic of the span of information stored in the record of the first database. Also, the plurality of generated instances are generated using the record of the first database or a corresponding history file record.
Further, at a previous synchronization, a plurality of instances of the second database is generated based on a second previously determined pattern for generating a plurality of instances which in combination represent a span of information. At the previous synchronization, information is stored in the history file reflecting the second previously determined pattern. That information is then retrieved from the history file during the current synchronization. The retrieved information determines the pattern used for generating the second plurality of records of the second database.
In some embodiments, for example, when a history file is not available, to identify a plurality of records of the second database to the record of the first database, a first plurality of instances are generated based on a first previously determined pattern for generating a plurality of instances which in combination represent the span of information stored by the record of the first database. A second plurality of the records of the second database are then correlated to the first plurality of generated instances by comparing the first plurality of generated instances to the records of the second database. A second plurality of instances are generated based on a second previously determined pattern for generating a plurality of instances which in combination represent a span of information. A third plurality of the records of the second database are correlated to the second plurality of generated instances by performing a comparison of the second plurality of generated instances to the records of the second database. The identified plurality of records of the second database are then identified based on the results of correlating the second plurality of the second database to the first plurality of generated instances and the third plurality of the second database records to the second plurality of generated instances. To do so, the number of records in the second plurality of instances of the second database is then compared to the number of records in the third plurality of instances of the second database.
In some embodiments, when the records of the second database are assigned unique identifications, a plurality of instances are generated, at a previous synchronization, based on a previously determined pattern for generating a plurality of instances which in combination represent the span of information stored by the record of the first database. At the previous synchronization, the generated records are stored in the second database. Also, at the previous synchronization, information is stored in a history file to reflect the unique identifications of the generated instances stored in the second database. In this case, to identify a plurality of records of the second database to the record of the first database further, the history file information is retrieved and correlated to unique identifications of the records of the second database. The identified records of the second database are determined to be the correlated records of the second database.
The span of information represented by the record of the first database may be textual information, where size of the textual information is larger than that permitted by the second database. The plurality of records of the second database then include textual information, the textual information of the plurality of records of the second database in combination represent the textual information represented by the record of the first database.
In another aspect, the invention features a computer program and a computer implemented method for storing a record of a first database in a second database where the record of the first database stores a span of information and the second database is not capable of storing such span of information in a single record. A plurality of records of the second database are generated to store the span of information of the record of the first database, each of the plurality of the records of the second database storing a portion of the span of the information, where the plurality of records of the second database in combination store a selected segment of the span of information less than the entirety of the span of information.
Preferred embodiments of the invention may include one or more of the following features.
The selected segment is a selected date range narrower than the date range of the second database. The selected date range is determined relative to a selected date by applying a rule. The rule can be a preference for future dates compared to a current date over past dates compared to the current date, a preference for dates closer to a current date over dates further from the current date, and a limit on a total number of generated records.
The invention may be implemented in hardware or software, or a combination of both. Preferably, the technique is implemented in computer programs executing on programmable computers that each include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Program code is applied to data entered using the input device to perform the functions described above and to generate output information. The output information is applied to one or more output devices.
Each program is preferably implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the programs can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language.
Each such computer program is preferably stored on a storage medium or device (e.g., ROM or magnetic diskette) that is readable by a general or special purpose programmable computer for configuring and operating the computer when the storage medium or device is read by the computer to perform the procedures described in this document. The system may also be considered to be implemented as a computer-readable storage medium, configured with a computer program, where the storage medium so configured causes a computer to operate in a specific and predefined manner.